async function callFollow(uid, unf) {
    return new Promise(async r => {
        if (!(await login_check())) return alert('未登录'), r(null);
        if (userInfo.info.uid == uid) return alert('不能关注自己'), r(null);
        $.get('/user/follow', { fid: unf ? -uid : uid /*,isPrivate:true,isSpecial:true,group:'abc'*/ })
            .then(result => {
                if (result && result.success) r(result.result);
                else if (result) alert(result.err);
                else alert('请求失败');
                r(null);
            }).catch(e => {
                alert('请求失败');
                console.log(e);
                r(null);
            })
    });
}

function callFollowBtn(tar, uid, f = '关注', uf = '已关注') {
    if (!uid) return;
    tar = $(tar);
    let nowFollow = tar.hasClass('followed');
    (async () => {
        let r = await callFollow(uid, nowFollow);
        console.log(r);
        if (!r) return;
        tar[nowFollow ? 'removeClass' : 'addClass']('followed');
        tar.html(nowFollow ? f : uf);
    })();
}